package com.ld.caodan.entity;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * 
 * 
 * @author 刘笛 2011-11-1 上午09:21:36
 */
public class CaoDan implements ICaodan<Article> {

	List<Article> articles = new ArrayList<Article>(0);

	public CaoDan(String url) {
		try {
			Document document = Jsoup.connect(url).get();
			Elements elements = document.getElementsByAttributeValue("class",
					"article");
			for (Element element : elements) {
				Article article = new Article(element);
				articles.add(article);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} 
	}

	@Override
	public List<Article> getListBean() {
		return articles;
	}

}
